#include <cstdio>
#include <cstring>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
long long P = 30;
int n;
long long p[40040];
char  s[40040];
long long hash[40040];
int len;
void gethash()
{
	hash[0] = (s[0]-'a');
	for(int i = 1;i<len;i++)
	{
		hash[i] = hash[i-1]*P+s[i]-'a';
	}
}
int judge(int x)
{
	map<int,int>mp;
	long long temp;
	for(int i = 0;i+x-1<len;i++)
	{
		if(i==0) temp = hash[i+x-1];
		else temp = hash[i+x-1]-hash[i-1]*p[x];
		if(++mp[temp]>=n) return 1;
	}
	return 0;
}
int check(int x)
{
	map<int,int>mp;
	long long temp;
	int pos;
	for(int i = 0;i+x-1<len;i++)
	{
		if(i==0) temp = hash[i+x-1];
		else temp = hash[i+x-1]-hash[i-1]*p[x];
		if(++mp[temp]>=n) pos = i;
	}
	return pos;
}
int main()
{ 
	p[0]=1;
	for(int i = 1;i<=40010;i++)
	{
		p[i] = p[i-1]*P;
	}
	while(scanf("%d",&n)&&n)
	{
		scanf("%s",s);
		len = strlen(s);
		gethash();
		int r = len+1;
		int l = 1;
		int mid;
		while(l<=r)
		{
			mid = (l+r)/2;
			if(judge(mid)) l = mid+1;
			else r = mid-1;
		}
		if(r==0) printf("none\n");
		else 
		{
			printf("%d %d\n",r,check(r));
		}
	}
} 
